#ifndef MYMODEL_H
#define MYMODEL_H

#include <QAbstractTableModel>
#include <QObject>
#include "common.h"

class MyModel : public QAbstractTableModel
{
    Q_OBJECT
public:
    explicit MyModel(QObject *parent = nullptr);
    ~MyModel();

    enum TableType{
        TableType_BMS208 = 0,
        TableType_BMS_39A_Temp,
        TableType_BMS_39A_Cell
    };

    int rowCount(const QModelIndex &parent = QModelIndex())const override;
    int columnCount(const QModelIndex &parent = QModelIndex())const override;
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole)const override;
    QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
    bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
    virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());

    void SetCurrentTableTyoe(TableType type);

    void SetDeleteList(QList<int> i_List);

    void SetHeadData(QStringList i_list);

    void SetModelData(QList<BMS_Normal> model);

private:
    QList<BMS_Normal> m_BMS208ModelData;
    QStringList headeList;
    QList<int> m_DeleteList;

    TableType m_table_type;
};

#endif // MYMODEL_H
